//
//  MsgUserLocationCell.swift
//  swiftim
//
//  Created by yangjian on 2023/6/13.
//

import Foundation



class MsgUserLocationCell : MsgUserBaseCell{
    
    let mapImageView = UIImageView()
    let locationNameLabel = UILabel()
    let addressLabel = UILabel()
    
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.configMsgSubViews()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func configMsgSubViews() {
        configBubbleView(superView: msgBackgroundView, aboveView: msgContentView)

        msgContentView.addSubview(locationNameLabel)
        msgContentView.addSubview(addressLabel)
        msgContentView.addSubview(mapImageView)

        stateLabel.snp.makeConstraints { make in
            make.bottom.equalTo(self.msgContentView.snp.bottom)
            make.right.equalTo(self.msgContentView.snp.left).offset(-20)
        }
        

        locationNameLabel.snp.makeConstraints { make in
            make.top.equalTo(2)
            make.left.equalTo(MsgCellOtherLayoutAdapterConfig.share.locationCellTextLeftAndRightSide)
            make.right.equalTo(-MsgCellOtherLayoutAdapterConfig.share.locationCellTextLeftAndRightSide)
            make.height.equalTo(20)
        }
        
        addressLabel.snp.makeConstraints { make in
            make.top.equalTo(2)
            make.left.equalTo(MsgCellOtherLayoutAdapterConfig.share.locationCellTextLeftAndRightSide)
            make.right.equalTo(-MsgCellOtherLayoutAdapterConfig.share.locationCellTextLeftAndRightSide)
        }

        mapImageView.snp.makeConstraints { make in
            make.top.equalTo(addressLabel.snp.bottom).offset(2)
            make.bottom.equalTo(msgContentView)
            make.left.equalTo(msgContentView)
            make.right.equalTo(msgContentView)
            make.width.equalTo(MsgCellOtherLayoutAdapterConfig.share.locationCellMsgContentWidth)
            make.height.equalTo(100)
        }
    }
    
    override func resetSubViewsLayout(showName: Bool, showHead: Bool) {
        super.resetSubViewsLayout(showName: showName, showHead: showHead)
        resetBubbleleView(aboveView: msgContentView)

    }
    
    override func bindFromModel(_ model: MsgCellBaseModel) {
        super.bindFromModel(model)
        
        
        
//        let body = model.message.body as! EMVideoMessageBody
//        guard let img = UIImage(contentsOfFile: body.thumbnailLocalPath ?? "") else {
//            //显示默认图片
//            return
//        }
//        self.msgImageView.image = img
    }

    
    
    
    
    
    
    
    
}
